{extend name="$admin_layout" /}
{block name="style"}
{volist name="set_style" id="s"}
<link rel="stylesheet" href="{$s}"/>{/volist}
{/block}
{block name="content"}
<div class="row">
    <div class="col-md-12">
        <div class="box nav-tabs-custom">
            <div class="box-header with-border">
                <h3 class="box-title">{$page_title|default=""|htmlspecialchars}</h3>
            </div>
            <div class="box-body tab-content">
                <div class="tab-pane active">
                    <div class="block-content" style="max-width: 600px;">
                        {php}
                        $url_param = input('param.');
                        {/php}
                        <!-- 表单验证请保留id="form"，否则验证不起作用 -->
                        <form class="form row" name="form" id="form" parent_reload="{$url_param.reload|default = '-1'}"
                              action="{:url('',$url_param)}" method="post"
                              data-validator-option="{timely:1, theme:'bootstrap'}">
                            <input type="hidden" name="__token__" value="e4f4f7de4a3e1d97f62122e7b4fa6105"/>
                            <!--<div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12" id="form_group_user_id">
                                <div class="col-xs-12 label-title" for="user_id" style="padding-left: 0">会员ID/名称/昵称/电话</div>
                                <select name="{$search_val.name}" class="select2">
                                    <option value="aaa">aaaaaa</option>
                                </select>
                            </div>-->
                            <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12" id="form_group_{$form.name}">
                                <div class="col-xs-12 label-title" for="user_id">{:lang('会员')}ID/{:lang('名称')}/{:lang('昵称')}/{:lang('电话')}</div>
                                <div class="col-sm-12">
                                    <select class="select2 form-control" id="user_id" name="user_id" onchange="">
                                        <option value="">{:lang('请选择会员')}</option>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12" id="form_group_money">
                                <div class="col-xs-12 label-title" for="money">{:lang('充值积分')}</div>
                                <div class="col-sm-12">
                                    <input class="form-control" type="text" id="money" name="money" value=""
                                           placeholder="{:lang('请输入充值积分')}">
                                </div>
                            </div>
                            <div class="form-group col-md-12 col-xs-12">
                                <div class="col-xs-12">
                                    <button class="btn btn-primary " type="submit"> {:lang('提交')}</button>
                                    <button class="btn btn-default " type="button"
                                            onClick="javascript:history.back(-1);return false;"> {:lang('返回')}
                                    </button>
                                </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="script"}
{volist name="set_script" id="s"}
<script type="text/javascript" src="{$s}"></script>
{/volist}
<script type="text/javascript">
    $(function () {
        //远程筛选
        $("#user_id").select2({
            placeholder: '请输入',
            ajax: {
                url: "{:url('finance/searchUser')}",
                dataType: 'json',
                delay: 250,
                data: function (params) {
                    return {
                        key: params.term, // search term
                        page: params.page
                    };
                },
                processResults: function (data, params) {
                    params.page = params.page || 1;

                    return {
                        results: data.results,
                       /* pagination: {
                            more: (params.page * 10) < 110//data.total_count
                        }*/
                    };
                },
                cache: true
            },
            escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
            minimumInputLength: 1,
            //templateResult: formatRepoProvince, // omitted for brevity, see the source of this page
            //templateSelection: formatRepoProvince // omitted for brevity, see the source of this page
        });
    });
</script>

{/block}
